package org.pupil.router;

import org.pupil.common.constants.LoadBalance;
import org.pupil.router.impl.RoundRobinLoadBalancer;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 负载均衡工厂
 * @Author: pupil
 * @Date: 2024/07/16 下午 3:29
 */
public class LoadBalancerFactory {

    private static Map<LoadBalance,LoadBalancer> loadBalancerMap = new HashMap<>();

    static {
        loadBalancerMap.put(LoadBalance.Round,new RoundRobinLoadBalancer());
    }

    public static LoadBalancer get(LoadBalance loadBalance){
        return loadBalancerMap.get(loadBalance);
    }
}
